<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form id="register" action="#" >
    <input type="text" name="username" />

    <input type="submit" value="提交">
</form>

<script>
    document.getElementById("register").onsubmit = function (){
        //onsubmit 返回true，则表单会被提交，返回false，则表单不提交
        return true;
    }



</script>

</body>
</html>